package com.woniuxy.java106crm.service.impl;

import com.woniuxy.java106crm.entity.CustomerLinkman;
import com.woniuxy.java106crm.mapper.CustomerLinkmanMapper;
import com.woniuxy.java106crm.service.CustomerLinkmanService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class CustomerLinkmanServiceImpl implements CustomerLinkmanService {
    @Resource
    private CustomerLinkmanMapper customerLinkmanMapper;
    @Override
    public List<CustomerLinkman> findAllLinkmanByCid(String cid) {
        List<CustomerLinkman> linkman = customerLinkmanMapper.findAllLinkmanByCid(cid);
        return linkman;
    }

    @Override
    public boolean addLinkman(CustomerLinkman linkman) {
        return customerLinkmanMapper.addLinkman(linkman);
    }

    @Override
    public boolean deleteById(Integer id) {
        return customerLinkmanMapper.deleteById(id);
    }

    @Override
    public boolean updateById(CustomerLinkman linkman) {
        return customerLinkmanMapper.updateById(linkman);
    }

    @Override
    public void batchedDelByIds(String ids) {
        String[] splits = ids.split(",");
        for (String id: splits) {
            customerLinkmanMapper.deleteById(Integer.valueOf(id));
        }
    }
}
